package com.zz.parkingsystem.controller.admin;

import com.zz.parkingsystem.aop.LogAnnotation;
import com.zz.parkingsystem.dto.CarMessageDTO;
import com.zz.parkingsystem.dto.CarOrderMessageDTO;
import com.zz.parkingsystem.service.CarService;
import com.zz.parkingsystem.util.Result;
import com.zz.parkingsystem.util.ResultGenerator;
import com.zz.parkingsystem.vo.PageResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author wangyuxiang
 */
@Api(tags = "车辆请求")
@RestController
@RequestMapping("/adminCar")
public class AdminCarController {
    @Resource
    private CarService carService;

    @PostMapping("/queryAllCarMessage")
    @ApiOperation("查询车辆管理页面所有数据")
    @ApiParam(name = "CarMessageDTO",value = "CarMessageDTO")
    @LogAnnotation(module = "车辆模块",operation = "查询所有车辆")
    public Result queryAllCarMessage(@RequestBody CarMessageDTO carDTO){
        PageResult list = carService.queryAllCarMessage(carDTO);
        return ResultGenerator.genSuccessResult(list);
    }

    @PostMapping("/queryAllCarOrderMessage")
    @ApiOperation("查询车辆管理页面每个车的所有订单")
    @ApiParam(name = "CarOrderMessageDTO",value = "")
    public Result queryAllCarOrderMessage(@RequestBody() CarOrderMessageDTO carOrderMessageDTO){
        PageResult list = carService.queryAllCarOrderMessage(carOrderMessageDTO);
        return ResultGenerator.genSuccessResult(list);
    }






}
